﻿(function ($) {
    $.browser32 = function () {
        $(window).resize(function () {
            $("#bg1").followParent32({ left: 0, top: 0 });
            $("#bg2").followParent32({ right: 0, top: 0 });
            $("#bg3").followParent32({ left: 0, bottom: 0 });
            $("#bg4").followParent32({ right: 0, bottom: 0 });

            $("#bgTop").followParent32({ left: $("#bg1").width(), top: 0, cutWidth: $("#bg1").width() + $("#bg2").width() });
            $("#bgBottom").followParent32({ left: $("#bg3").width(), bottom: 0, cutWidth: $("#bg1").width() + $("#bg2").width() });
            $("#bgLeft").followParent32({ left: 0, top: $("#bg1").height(), cutHeight: $("#bg1").height() + $("#bg3").height() });
            $("#bgRight").followParent32({ right: 0, bottom: $("#bg4").height(), cutHeight: $("#bg2").height() + $("#bg4").height() });

            $("#toolBoard").followParent32({ center: true });

            $("#window").followParent32({
                cutWidth: $("#bg1").width() + $("#bg2").width(),
                cutHeight: $("#bg1").height() + $("#bg3").height()
            });

            $("#windowInner").followParent32({
                cutWidth: 0,
                cutHeight: $("#titleBar").height()
            });

            /*----------------------------------------------------windowInner*/
            $("#plateBook").followParent32({ cutHeight: 0 });
            $("#platePage").followParent32({ cutHeight: 0 });
            $("#plateRegion").followParent32({ cutWidth: $("#plateBook").width() + $("#platePage").width(), cutHeight: 0 });

            /*----------------------------------------------------plate*/
            $("#plateBook").find("#recycleBin").followParent32({ bottom: 8 });
            $("#plateBook").find(".line2").followParent32({ bottom: 64 });
            $("#plateBook").find("#stretch1").followParent32({ right: 0, cutHeight: 0 });


            $("#plateBook").find("#bookList").followParent32({ top: 30, cutWidth: 4, cutHeight: 100 });
            $("#platePage").find("#pageList").followParent32({ top: 30, cutWidth: 0, cutHeight: 30 });

            /*----------------------------------------------------plateRegion*/
            $("#plateRegion").find("#toolBar").followParent32({ left: 0, top: 0, cutWidth: 0 });
            $("#plateRegion").find("#infBar").followParent32({ left: 0, top: $("#toolBar").height(), cutWidth: 0 });
            $("#plateRegion").find("#region").followParent32({
                cutHeight: $("#toolBar").height() + $("#infBar").height(),
                right: 0, bottom: 0, cutWidth: 0
            });

        });

        $("#bg1").followParent32({ left: 0, top: 0 });
        $("#bg2").followParent32({ right: 0, top: 0 });
        $("#bg3").followParent32({ left: 0, bottom: 0 });
        $("#bg4").followParent32({ right: 0, bottom: 0 });

        $("#bgTop").followParent32({ left: $("#bg1").width(), top: 0, cutWidth: $("#bg1").width() + $("#bg2").width() });
        $("#bgBottom").followParent32({ left: $("#bg3").width(), bottom: 0, cutWidth: $("#bg1").width() + $("#bg2").width() });
        $("#bgLeft").followParent32({ left: 0, top: $("#bg1").height(), cutHeight: $("#bg1").height() + $("#bg3").height() });
        $("#bgRight").followParent32({ right: 0, bottom: $("#bg4").height(), cutHeight: $("#bg2").height() + $("#bg4").height() });

        $("#bgTop").find(".bg").followParent32({ left: 0, top: 0 });
        $("#bgBottom").find(".bg").followParent32({ left: 0, top: 0 });
        $("#bgLeft").find(".bg").followParent32({ left: 0, top: 0 });
        $("#bgRight").find(".bg").followParent32({ left: 0, top: 0 });

        $("#bgTop").find(".logo").followParent32({ left: 0, top: 0 });
        $("#bgTop").find(".guide").followParent32({ right: 0, top: 0 });

        $("#toolBoard").followParent32({ center: true, middle: true });
        $("#toolBoard").find("li:eq(0)").css({ "margin-left": 30 });

        $("#window").followParent32({
            left: $("#bg1").width(),
            top: $("#bg1").height(),
            cutWidth: $("#bg1").width() + $("#bg2").width(),
            cutHeight: $("#bg1").height() + $("#bg3").height()
        });

        $("#titleBar").followParent32({ left: 0, top: 0 });
        $("#windowInner").followParent32({
            left: 0,
            bottom: 0,
            cutWidth: 0,
            cutHeight: $("#titleBar").height()
        });

        /*----------------------------------------------------windowInner*/
        $("#plateBook").followParent32({ cutHeight: 0 });
        $("#platePage").followParent32({ cutHeight: 0 });
        $("#plateRegion").followParent32({ cutWidth: $("#plateBook").width() + $("#platePage").width(), cutHeight: 0 });

        /*----------------------------------------------------plate*/
        $("#plateBook").followParent32({ left: 0, top: 0, cutHeight: 0 });
        $("#platePage").followParent32({ left: $("#plateBook").width(), top: 0, cutHeight: 0 });
        $("#plateRegion").followParent32({
            right: 0,
            top: 0,
            cutWidth: $("#plateBook").width() + $("#platePage").width(),
            cutHeight: 0
        });



        /*----------------------------------------------------plateBook*/
        $("#plateBook").find("#bookList").followParent32({ top: 30, cutWidth: 0, cutHeight: 100 });
        $("#plateBook").find("#bookList .arrow").followParent32({ right: 0 });
        $("#plateBook").find("#bookShrink1").followParent32({ right: 6, top: 10 });
        $("#plateBook").find("#recycleBin").followParent32({ right: 20, bottom: 8 });
        $("#plateBook").find(".line1").followParent32({ left: 0, top: 28 });
        $("#plateBook").find(".line2").followParent32({ left: 0, bottom: 64 });
        $("#plateBook").find("#stretch1").followParent32({ top: 0, right: 0, cutHeight: 0 });
        //$("#plateBook").find("#newBook").followParent32({ right: 20 });

        /*----------------------------------------------------platePage*/
        $("#platePage").find(".line1").followParent32({ left: 0, top: 28 });
        $("#platePage").find("#pageList").followParent32({ top: 30, cutWidth: 0, cutHeight: 30 });
        $("#platePage").find("#pageShrink2").followParent32({ right: 6, top: 10 });
        $("#platePage").find("#stretch2").followParent32({ top: 0, right: 0, cutHeight: 0 });

        /*----------------------------------------------------plateRegion*/
        $("#plateRegion").find("#toolBar").followParent32({ left: 0, top: 0, cutWidth: 0 });
        $("#plateRegion").find("#infBar").followParent32({ left: 0, top: $("#toolBar").height(), cutWidth: 0 });
        $("#plateRegion").find("#region").followParent32({
            cutHeight: $("#toolBar").height() + $("#infBar").height(),
            right: 0, bottom: 0, cutWidth: 0
        });

        $("#toolBar").find(".save").followParent32({ left: 20, top: 2 });
        $("#toolBar").find(".share").followParent32({ left: 50, top: 2 });
        $("#toolBar").find(".add").followParent32({ left: 80, top: 2 });
        $("#toolBar").find(".del").followParent32({ left: 110, top: 2 });

        $("#infBar").find(".titleOuter").followParent32({ left: 20, top: 0 });
        $("#infBar").find(".titleOuter .title").followParent32({ left: 0, middle: true });


        /*----------------------------------------------------隐藏的字段*/
        $("#plateBookWidth").val($("#plateBook").width());
        $("#platePageWidth").val($("#platePage").width());
        $("#plateRegionWidth").val($("#plateRegion").width());


        /*----------------------------------------------------piece*/
        $("#regionInner").find(".piece").piece32({ active: true });

    }
})(jQuery);